home *** CD-ROM | disk | FTP | other *** search
/ Dos/V Magazine 1995 October 15 / CD [VMAG951015].bin / _demo / w95demo / shared.dir / 00380_EVENT ROUTINES.ls < prev    next >
Encoding:
Text File  |  1995-08-22  |  6.9 KB  |  268 lines

  1. on stopMovie
  2.   dialogClose()
  3. end
  4.  
  5. on doControl delayTime
  6.   global gAutoMode, gTeaserMode, gResellerVersion, gAutoDelay, gAutoTestMode, gTopicList, gCurrTopic, gDialogWindow, gLastTextBox, gSectionAnimationSpeed, gCDROMversion, gLastAudio, gAudioPath
  7.   if objectp(gDialogWindow) then
  8.     go(the frame)
  9.     exit
  10.   end if
  11.   if gCDROMversion = 1 then
  12.     if the type of sprite 22 = 7 then
  13.       set audioFname to the name of cast the castNum of sprite 22
  14.       if audioFname <> gLastAudio then
  15.         preLoad(marker(1))
  16.         set gLastAudio to audioFname
  17.         waitMouse(30)
  18.         delete char 7 to 10 of audioFname
  19.         puppetSound(cast audioFname)
  20.         updateStage()
  21.       end if
  22.     end if
  23.   end if
  24.   if gAutoMode = 1 then
  25.     if voidp(delayTime) then
  26.       if the type of sprite 22 = 7 then
  27.         set frameText to the text of cast the castNum of sprite 22
  28.         set delayTime to the number of chars in frameText * gAutoDelay
  29.         if gLastTextBox = frameText then
  30.           set differentText to 0
  31.           set delayTime to delayTime / 7
  32.         else
  33.           set differentText to 1
  34.           set gLastTextBox to frameText
  35.         end if
  36.       else
  37.         set delayTime to gSectionAnimationSpeed
  38.       end if
  39.     else
  40.       set delayTime to delayTime * 60
  41.     end if
  42.     if differentText = 0 then
  43.       if gAutoTestMode = 0 then
  44.         if waitMouse(delayTime) then
  45.           exit
  46.         end if
  47.       else
  48.         if waitMouse() then
  49.           exit
  50.         end if
  51.       end if
  52.     else
  53.       if waitMouse(delayTime / 2) then
  54.         exit
  55.       end if
  56.     end if
  57.     if (((the frame + 1) = marker(1)) or (the frameLabel = "end")) and soundBusy(1) then
  58.       if waitAudioMouse(1) then
  59.         exit
  60.       end if
  61.       if waitMouse(160) then
  62.         exit
  63.       end if
  64.     end if
  65.     if the frameLabel <> "end" then
  66.       go(the frame + 1)
  67.     else
  68.       set gCurrTopic to gCurrTopic + 1
  69.       if (gCurrTopic < 1) or (gCurrTopic > the number of lines in gTopicList) then
  70.         set gAutoMode to 0
  71.         if gResellerVersion = 1 then
  72.           if gTeaserMode = 0 then
  73.             endAutoDemoDialogReseller()
  74.             exit
  75.           else
  76.             goCloser()
  77.           end if
  78.         else
  79.           endAutoDemoDialog()
  80.           exit
  81.         end if
  82.       else
  83.         set topic to line gCurrTopic of gTopicList
  84.         go(1, topic)
  85.       end if
  86.     end if
  87.   else
  88.     if the frame = marker(0) then
  89.       if the type of sprite 37 = 0 then
  90.         blinkForwardArrow()
  91.       else
  92.         showNextBtn()
  93.       end if
  94.     else
  95.       showNextBtn()
  96.     end if
  97.   end if
  98. end
  99.  
  100. on waitMouse t
  101.   if voidp(t) then
  102.     set t to 10
  103.   end if
  104.   startTimer()
  105.   repeat while the timer < t
  106.     if the mouseDown then
  107.       return 1
  108.     end if
  109.   end repeat
  110.   return 0
  111. end
  112.  
  113. on waitAudioMouse ch
  114.   repeat while soundBusy(ch)
  115.     if the mouseDown then
  116.       return 1
  117.     end if
  118.   end repeat
  119.   return 0
  120. end
  121.  
  122. on wait t
  123.   if voidp(t) then
  124.     set t to 10
  125.   end if
  126.   startTimer()
  127.   repeat while the timer < t
  128.     nothing()
  129.   end repeat
  130. end
  131.  
  132. on keyDown
  133.   global gMainMovieName, gResellerVersion, gAutoMode, gNextKey, gBackKey, gMenuKey, gRestartKey, gExitKey
  134.   set k to the key
  135.   set kcode to the keyCode
  136.   if (the movie <> gMainMovieName) and (gAutoMode = 0) then
  137.     set channel to 0
  138.     if k = gNextKey then
  139.       set channel to 24
  140.     else
  141.       if k = gBackKey then
  142.         set channel to 23
  143.       else
  144.         if k = gMenuKey then
  145.           set channel to 25
  146.         else
  147.           if (k = gRestartKey) and (gResellerVersion = 1) then
  148.             set channel to 28
  149.           else
  150.             if (k = gExitKey) and (gResellerVersion = 0) then
  151.               set channel to 27
  152.             else
  153.               if kcode = 53 then
  154.                 exitDialog()
  155.                 dontPassEvent()
  156.               else
  157.                 if (k = TAB) or (k = RETURN) or (k = ENTER) then
  158.                   doControlPanelKeys()
  159.                   exit
  160.                 end if
  161.               end if
  162.             end if
  163.           end if
  164.         end if
  165.       end if
  166.     end if
  167.     if channel <> 0 then
  168.       hiliteButton(channel)
  169.       set gDontHilite to 0
  170.       mouseDown(script the scriptNum of sprite channel)
  171.     end if
  172.   end if
  173. end
  174.  
  175. on doControlPanelKeys
  176.   global gCurrCPButton, gCPbuttonIndex, gDontHilite, gAutoMode
  177.   if voidp(gCurrCPButton) or (gCurrCPButton = 0) then
  178.     set gCurrCPButton to 1
  179.   end if
  180.   set lastspritePos to gCurrCPButton
  181.   set startSprite to 1
  182.   set endSprite to 4
  183.   if gAutoMode = 1 then
  184.     exit
  185.   end if
  186.   if the key = TAB then
  187.     if not (the shiftDown) then
  188.       if lastspritePos < endSprite then
  189.         set gCurrCPButton to gCurrCPButton + 1
  190.       else
  191.         set gCurrCPButton to startSprite
  192.       end if
  193.     else
  194.       if lastspritePos = startSprite then
  195.         set gCurrCPButton to endSprite
  196.       else
  197.         set gCurrCPButton to gCurrCPButton - 1
  198.       end if
  199.     end if
  200.     set lastsprite to value(line lastspritePos of gCPbuttonIndex)
  201.     set c to the castNum of sprite lastsprite
  202.     set the castNum of sprite lastsprite to c - 1
  203.     set newSprite to value(line gCurrCPButton of gCPbuttonIndex)
  204.     set c to the castNum of sprite newSprite
  205.     set the castNum of sprite newSprite to c + 1
  206.     updateStage()
  207.   else
  208.     if (the key = RETURN) or (the key = ENTER) then
  209.       set lastsprite to value(line lastspritePos of gCPbuttonIndex)
  210.       hiliteButton(lastsprite)
  211.       resetNextButton()
  212.       set gDontHilite to 1
  213.       mouseDown(script the scriptNum of sprite lastsprite)
  214.     end if
  215.   end if
  216. end
  217.  
  218. on resetNextButton
  219.   global gCurrCPButton, gCPbuttonIndex
  220.   set lastspritePos to gCurrCPButton
  221.   set gCurrCPButton to 1
  222.   set lastsprite to value(line lastspritePos of gCPbuttonIndex)
  223.   set c to the castNum of sprite lastsprite
  224.   set the castNum of sprite lastsprite to c - 1
  225.   set newSprite to value(line gCurrCPButton of gCPbuttonIndex)
  226.   set c to the castNum of sprite newSprite
  227.   set the castNum of sprite newSprite to c + 1
  228. end
  229.  
  230. on doMenuKeys theKey, startSprite, endSprite
  231.   global gCurrDialogButton, gDontHilite, gResellerVersion
  232.   if voidp(gCurrDialogButton) or (gCurrDialogButton = 0) then
  233.     set gCurrDialogButton to 9
  234.   end if
  235.   set lastsprite to gCurrDialogButton
  236.   if the key = TAB then
  237.     if not (the shiftDown) then
  238.       if lastsprite < endSprite then
  239.         set gCurrDialogButton to gCurrDialogButton + 1
  240.       else
  241.         set gCurrDialogButton to startSprite
  242.       end if
  243.     else
  244.       if lastsprite = startSprite then
  245.         set gCurrDialogButton to endSprite
  246.       else
  247.         set gCurrDialogButton to gCurrDialogButton - 1
  248.       end if
  249.     end if
  250.     set c to the castNum of sprite lastsprite
  251.     set the castNum of sprite lastsprite to c - 1
  252.     set c to the castNum of sprite gCurrDialogButton
  253.     set the castNum of sprite gCurrDialogButton to c + 1
  254.     updateStage()
  255.   else
  256.     if (the key = RETURN) or (the key = ENTER) then
  257.       hiliteButton(lastsprite)
  258.       set gDontHilite to 1
  259.       mouseDown(script the scriptNum of sprite lastsprite)
  260.     else
  261.       if the keyCode = 53 then
  262.         exitDialog()
  263.         dontPassEvent()
  264.       end if
  265.     end if
  266.   end if
  267. end
  268.